package main

import (
	"fmt"
)

func gen(s []int) {
	fmt.Println(111, s, cap(s), len(s))
	s = append(s, 4) // 触发了扩容
	fmt.Println(2222, s, cap(s), len(s))
	fmt.Printf("address of A %p \n", s)
}

func gen2(s []int) {
	s[1] = 22
	fmt.Printf("address of B %p \n", s)
}

func main() {
	name := []int{1, 2, 3}
	fmt.Println(name) // [1 2 3]
	fmt.Printf("address of C %p \n", name)
	gen(name)
	fmt.Println(name) // [1 2 3]
	gen2(name)
	fmt.Println(name) // [1 22 3]

}
